package 一个简单的整数问题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static int N = 100010, n, m;
    static int[] a = new int[N];
    static long[] tr = new long[N];

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String[] s = in.readLine().split(" ");
        n = Integer.parseInt(s[0]);
        m = Integer.parseInt(s[1]);
        String[] s1 = in.readLine().split(" ");
        for (int i = 1; i <= n; i++) {
            a[i] = Integer.parseInt(s1[i - 1]);
            add(i, a[i] - a[i - 1]);
        }
        while (m-- > 0) {
            String[] s2 = in.readLine().split(" ");
            if (s2[0].equals("Q")) {
                int x = Integer.parseInt(s2[1]);
                System.out.println(sum(x));
            } else {
                int l = Integer.parseInt(s2[1]);
                int r = Integer.parseInt(s2[2]);
                int c = Integer.parseInt(s2[3]);
                add(l, c);
                add(r + 1, -c);
            }
        }
    }

    private static long sum(int x) {
        long ret=0;
        for (int i = x; i >=1 ; i-=lowbit(i)) {
            ret+=tr[i];
        }
        return ret;
    }

    private static void add(int x, long c) {
        for (int i = x; i <= n; i += lowbit(i)) {
            tr[i] += c;
        }
    }

    private static int lowbit(int x) {
        return x & -x;
    }
}
